package lanou.autohome.recommend.fragments;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import java.util.ArrayList;

import lanou.autohome.URLValues;
import lanou.autohome.basetool.BaseFragment;
import lanou.autohome.R;
import lanou.autohome.basetool.NetTool;
import lanou.autohome.recommend.adapters.EvaluationAdapter;
import lanou.autohome.recommend.adapters.SpeakAdapter;
import lanou.autohome.recommend.beans.EvaluationBean;
import lanou.autohome.recommend.beans.SpeakerBean;

/**
 * Created by dllo on 16/8/15.
 * 推荐 -> 说客 (首发replycount  177/4 和 独播replycount  60/147 判断不了)
 */
public class SpeakerFragment extends BaseFragment {

    private RecyclerView recyclerView;

    @Override
    protected int setLayout() {
        return R.layout.fragment_recommend_speaker;
    }

    @Override
    protected void initView() {

        recyclerView = bindVie(R.id.recyclerview_speak_recommend);
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    }

    @Override
    protected void intiData() {
        final SpeakAdapter speakAdapter = new SpeakAdapter(getContext());
        mNetTool.getNetData(URLValues.LOBBYISTS_URL, SpeakerBean.class, new NetTool.NetListener<SpeakerBean>() {
            @Override
            public void onSuccess(SpeakerBean speakerBean) {
                speakAdapter.setSpeakerBean(speakerBean);
                recyclerView.setAdapter(speakAdapter);
            }

            @Override
            public void onError(String errorMsg) {

            }
        });

    }
}
